/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ControladoresUI;

import Controladores.exceptions.PreexistingEntityException;
import Ingresos.IJornada;
import ManagersUI.JornadasRegistroManager;
import javafx.event.*;
import javafx.fxml.FXML;
import javafx.scene.control.TextField;
import javax.swing.JOptionPane;
/**
 * FXML Controller class
 *
 * @author JEscalante
 */
public class JornadasRegistroController{

    /**
     * Initializes the controller class.
     */
    JornadasRegistroManager jornadasRegistroManager;
    @FXML private TextField txtNombre;
    public void initialize() {}
  
    public void initManager(final JornadasRegistroManager jornadasRegistroManager) {
        this.jornadasRegistroManager = jornadasRegistroManager;
    }
    @FXML
    private void cerrarVentana(ActionEvent event){
        jornadasRegistroManager.cerrarCarrerasRegistro();
    }
    @FXML
    private void registroJornadas(ActionEvent event) throws PreexistingEntityException, Exception{
        IJornada manejo = new IJornada();
        manejo.guardar(txtNombre.getText());
        JOptionPane.showMessageDialog(null, "Se ha regisrtado la jornada");
        jornadasRegistroManager.cerrarCarrerasRegistro();
        
    }
}
